package com.zretc.service.impl;

import java.util.List;

import com.zretc.dao.FdtypeDao;
import com.zretc.dao.impl.FdtypeDaoImpl;
import com.zretc.entity.Fdtype;
import com.zretc.service.FdtypeService;
import com.zretc.tools.PageData;

public class FdtypeServiceImpl implements FdtypeService {
	FdtypeDao fdtypedao =new FdtypeDaoImpl();

	@Override
	public boolean addFdtype(Fdtype fdtype) {
		if (fdtype == null) {
			return false;
		}
		Fdtype ft=fdtypedao.getFdtypeByName(fdtype.getFdtypename());
		if (ft != null ) {
			return false;
		}
		return fdtypedao.addFdtype(fdtype);
		
	}

	@Override
	public PageData<Fdtype> getFdtypeByPage(int page, int pageSize, String keywords) {
		// TODO Auto-generated method stub
		if (page<1) {
			page=1;
		}
		return fdtypedao.getFdtypeByPage(page, pageSize, keywords);
	}

	@Override
	public List<Fdtype> getTypes() {
		// TODO Auto-generated method stub
		return fdtypedao.getFdtypes("");
	}

	@Override
	public Fdtype getFdtypeName(String fdtypename) {
		// TODO Auto-generated method stub
		return fdtypedao.getFdtypeByName(fdtypename);
	}

	@Override
	public boolean deleteFdtype(int fdtypeid) {
		// TODO Auto-generated method stub
		return fdtypedao.deleteFdtype(fdtypeid);
	}

}
